#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
class Solution0 {
public:
    void rotate(vector<int>& nums, int k) {
        vector<int>ans;
        int start=k%nums.size();
        for(int i=nums.size()-start;i<nums.size();i++)
        {
            ans.push_back(nums[i]);
        }
        for(int i=0;i<nums.size()-start;i++)
        ans.push_back(nums[i]);
        nums=ans;
    }
};
class Solution1 {
public:
    void rotate(vector<int>& nums, int k) {
        k=k%nums.size();
        reverse(nums.begin(), nums.end());
        reverse(nums.begin(),nums.begin()+k);
        reverse(nums.begin()+k+1,nums.end());
    }
};
